package com.example.commonlib.commonutil;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * Created by aiyou on 2017/8/23.
 */

public class SCacheUtil{

    /**
     * 缓存对象
     */
    public static void saveCacheAppData(String key,Object object){
        ACacheManager.getInstance().getaCache().remove(key);
        ACacheManager.getInstance().getaCache().put(key, (Serializable) object);
    }

    /**
     * 获取缓存对象
     */
    public static Object getCacheAppData(String key){
        Object object = ACacheManager.getInstance().getaCache().getAsObject(key);
        return object;
    }

    /**
     * 缓存对象集合
     */
    public static void saveListCacheAppData(String key,List<Object> appGameData){
        ACacheManager.getInstance().getaCache().remove(key);
        ACacheManager.getInstance().getaCache().put(key, (Serializable) appGameData);
    }

    /**
     * 获取缓存对象集合
     */
    public static List<Object> getListCacheAppData(String key){
        List<Object> appGameDataMap  = (List<Object>)ACacheManager.getInstance().getaCache().getAsObject(key);
        return appGameDataMap;
    }

    /**
     * 缓存
     */
    public static void saveListUserInfoCacheAppData(String key,List<Object> appGameData){
        ACacheManager.getInstance().getaCache().remove(key);
        ACacheManager.getInstance().getaCache().put(key, (Serializable) appGameData);
    }

    /**
     * 获取缓存
     */
    public static List<Object> getListUserInfoCacheAppData(String key){
        List<Object> appGameDataMap  = (List<Object>)ACacheManager.getInstance().getaCache().getAsObject(key);
        return appGameDataMap;
    }


    /**
     * 缓存
     */
    public static void saveMapUserInfoCacheAppData(String key,Map<String,Object> appGameDataMap){
        ACacheManager.getInstance().getaCache().remove(key);
        ACacheManager.getInstance().getaCache().put(key, (Serializable) appGameDataMap);
    }

    /**
     * 获取缓存
     */
    public static Map<String,Object> getMapUserInfoCacheAppData(String key){
        Map<String,Object> appGameDataMap  = (Map<String,Object>)ACacheManager.getInstance().getaCache().getAsObject(key);
        return appGameDataMap;
    }

}
